﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;
using BarCode.Common;

namespace BarCode.Module
{
    public class FileHelper
    {
        private static readonly log4net.ILog LogUtil = log4net.LogManager.GetLogger(typeof(FileHelper));

        /// <summary>
        /// 复制文件
        /// </summary>
        /// <param name="strFrom"></param>
        /// <param name="strTo"></param>
        /// <returns></returns>
        public static int CopyFile(string strFrom, string strTo)
        {
            try
            {
                File.Copy(strFrom, strTo, true);
                LogUtil.Debug("Copy File Successed." + strTo);
            }
            catch (IOException ex)
            {
                LogUtil.Error(ex);
                return Consts.RET_FAIL;
            }
            catch (Exception ex)
            {
                LogUtil.Error(ex);
                return Consts.RET_FAIL;
            }
            return Consts.RET_SUCCESS;
        }

    }
}
